package com.lovo.invoicing.utils;

import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.UUID;

public class FileUtils {
    public static String uploadFile(MultipartFile file) throws IOException {
        String sourceName = file.getOriginalFilename();
        String suffix = sourceName.substring(sourceName.lastIndexOf("."));
        String newFileName = UUID.randomUUID() + suffix;
        file.transferTo(new File("d:/imgs/"+newFileName));
        return newFileName;
    }


}
